The most comprehensive mobile chat room development experience in the history of sharing

Source: Internet
Author: User

First note what is mobile phone chat room, mobile phone is immediately the meaning of communication, simple is similar to QQ chat room software. and mobile phone chat room is the use of voice audio to replace the form of conservative text exchange to stop communication, the current market on the phone chat room based on the form of chat and how many kinds of form, one is to speak immediately like a telephone communication chat room software, in comparison with the hardware has uctalk,yy voice, etc. This kind of voice hardware to the main PC balcony, in addition to a conservative line of the way after the sound and conservative text im way slightly similar to the chat form, compared to the existence of special hardware has, Mo Mo, such as the majority of the voice hardware emerging is moving the end, the PC balcony is also in use in a large number of simultaneous. Then there is a kind of can be seen in the two ends, the simulation of the way to stop talking machine mode of chat form, this form is only a large number of applications on the PC has emerged, compared with the former two areas of the use of small.
This time we are doing a mobile project, in addition to the regular use of recording after sending the form of mobile phone voice chat, in the next unlettered understand no deep, because it can be objectively assumed that the way to record the completion of the voice IM completion of the rise from the skills will be much easier, After all, there is no idea of streaming media results.
is not only mobile phone voice chat does not touch some audio related achievements, the author is the iOS side of the development, because the main form of the iOS, iOS needs the avfoundation framework to complete the whole fragmented sound service without support beyond 30 seconds of audio playback performance, The sound-absorbing performance is also required for simultaneous use. And we have to use the Avaudiorecorder and Avaudioplayer two classes, through the name we can identify, the front end is the need for audio recording service and then the need to play service. Avaudiorecorder the sound to external memory or facility field information in the same way as the ethnic groups. The playback process can then be used sequentially to perform the rest of the performance when the continuation stops. The Avaudioplayer can play an arbitrary length of audio. Use a class to complete the Tour soundtrack and the rest of the simple audio usage sequence. Ability to name the playback process, including simultaneous playback of multiple audio materials. There is no doubt that iOS needs the audio service to grow and to be convenient. The use of Avfoundation framework in advance must be avfoundation.framework and coreaudio.framework exit to the nominal, and then export two interface data.
#import <AVFoundation/AVFoundation.h>
#import <CoreAudio/CoreAudioTypes.h>
Detailed use of the example code as follows, the first is the use of audio recording methods:

Here is the whole of the phone chat room playing audio:

Now we are to carefully read the meaning of the two-paragraph code, the first is the audio recording code, we have affirmed that besides define how many kind of goods, the creation of the audio parameter key value for Myrecordparam, once the road array Patharray, Once docment Docmentpath string and the supporting role of our step avaudiorecorder for like Myrecorder.
Let's first comment on the access to the road, as for the audio parameters, the play demand is not in front of it.
Nssearchpathfordirectoriesindomains is one of the first ways to search for a way in iOS, which is enumerated in the first two of the three parameters, while the initial parameter is the bool type, and the enumerated list of the parameter as follows:
enum {
Nsapplicationdirectory = 1,//supported Applications (/applications)
nsdemoapplicationdirectory,//unsupported applications and demonstration versions
Nsdeveloperapplicationdirectory,//developer Applications (/developer/applications)
Nsadminapplicationdirectory,//system and network administration applications
Nslibrarydirectory,//various user-visible documentation, support, and configuration files (/library)
Nsdeveloperdirectory,//developer Resources (/developer)
Nsuserdirectory,//user Home Directories (/users)
nsdocumentationdirectory,//
nsdocumentdirectory,//
Nscoreservicedirectory,//location of Core Services (system/library/coreservices)
Nsautosavedinformationdirectory = 11,//location of user ' s autosaved documents Library/autosave information
Nsdesktopdirectory = 12,//
Nscachesdirectory = 13,//location of discardable cache files (library/caches)
Nsapplicationsupportdirectory = 14,//location of application support files (library/application support)
Nsdownloadsdirectory = 15,//
Nsinputmethodsdirectory = 16,//
Nsmoviesdirectory = 17,//
Nsmusicdirectory = 18,//
Nspicturesdirectory = 19,//
Nsprinterdescriptiondirectory = 20,//
Nssharedpublicdirectory = 21,//
Nspreferencepanesdirectory = 22,//
Nsitemreplacementdirectory = 99,//
Nsallapplicationsdirectory = 100,//
Nsalllibrariesdirectory = 101//
};
Each one of them is expected to get the type of program, which is not only the program type in iOS, but also the type of road under the Mac, yes, as you think, a dependent variable is not common under iOS.
Enumeration list of the second parameter as follows
enum {
Nsuserdomainmask = 1,//in the owner's program
Nslocaldomainmask = 2,//later in the tool
Nsnetworkdomainmask = 4,//visible in the network leader
Nssystemdomainmask = 8,//Fragmented program, no correction (/system)
Nsalldomainsmask = 0x0ffff,//Full
};
The second parameter to search for the position of the person, this machine? Or a later order, or the rest of the computers that the WAN is connected to.
The three parameters are the one-bool value. Will he be able to go to the perfect way
And the access to the road does not contain the information name, we must remember to the beginning of the road to add the information we want to name, do not forget that we are to create a once audio material.
The consequences of this variable search can be a lot of ways, because you do not have access to the parameters according to the way you can contain the rest of the computer (the details of their own not measured, the people can further test, also hope that the consequences of sharing with themselves) because he has the consequences of an array, and we have to obtain the means of access is extremely is the order of Docment Road, moreover can be more sure is our order as long as docment, because we indirectly obtained the first to record.
Nothing to say is the avaudiorecorder is a bad guy, yes, he did not set the parameters of the structure dependent variables into a large number of parameters, it makes people seem to hurt, but he used a once more headaches, yes he let you go to manually install the parameter key value for, You didn't know what parameters to fill in, which parameters ... It's a nightmare (especially when they're low in English document browsing) that the as follows of the parameter keys I'm dominating are the relevant material of the key to the argument list:
Avsampleratekey,//sample rate
avformatidkey,//Audio Complement Styles
avlinearpcmbitdepthkey,//number of samples tacitly 16
Number of avnumberofchannelskey,//channels
avlinearpcmisbigendiankey,//big or small end is the external memory form of the body
avlinearpcmisfloatkey,//whether the sampling signal is a number or a floating point
avencoderaudioqualitykey,//Audio Complement quality
Because I think we don't understand the parameters we're going to give you crossing, because we're here to annotate the meaning of each parameter first is the sampling rate, which is easy to say is the waveform sampling method to record 1 minutes of sound, the demand for how many data. 44KHz sampling rate sound is to spend 44,000 data to describe the 1-minute sound waveform. The higher the sampling rate on the guideline, the better the sound quality.
The complement can be understood for each kind of audio style does not have the same codec, in the next about this understanding is not very much (can be familiar with all the codec of the person is the Idol-class Superman!) and iOS under the complement of the form is set to a once enumeration, and we use the code in the complement is the style of WAV data, want to use the rest of the complement way is successfully exported Avfouncation framework can be passed Xcode's active reminders identify the names of the kaudioformat that have been mop up.
Sampling number of samples or sampling values, is used to weigh the sound stability changes in the parameters, refers to the sound card is collecting and playing the sound data used in the number of Word sound signal binary times. The bit of the sound card subjectively reflects the precise level of the sound signal of the number of words to the output sound signal.
The number of channels should be well understood, 1 symbolizes the mono sound, 2 refers to the plane sound, 4 refers to four channels and so on.
Connected to the Avlinearpcmisbigendiankey refers to the re-external memory in the storage of audio, in the computer, the general adoption of the byte storage Mechanism has two secondary: Big-endian and Little-endian, that is, the big-endian form and the small end form. A parameter is a bool value, yes is a big end, and no is small. For big-endian and small-end related to two key words, MSB and LSB. Msb:most significant bit (highest invalid bit), lsb:least significant bit (lowest invalid bit) You can understand the starting position and stop status of a data re-external memory, the big-endian form is where the MSB is parked at the lowest end. The small-end form is where the LSB is parked at the lowest end.
In the Big-endian, about the ordinal form as follows in the bit sequence (in the case of double-byte 0x8b8a):
Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
--MSB ———————————-LSB
Val 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 0
+ —————————————— –+
In the Little-endian, the sequence numbering in the bit sequences is just as good as Big-endian, which is in the form of as follows (in the case of double-byte 0x8b8a):
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
--MSB ——————————— –LSB
Val 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 0
+ ——————————————— +
In short, you can understand the two-way storage is external memory.
About whether the sampling signal is a number or floating point is a type of bool parameter, I did not understand the meaning of the reaction, presumably to the audio signal to parse the accuracy of the time but did not dare to be set again, because there is no installation of a parameter.
The first parameter audio complement quality better understand, a parameter is once enumerated, we can find the avaudioquality mop up the high, low, Medium, Max, min Five kinds of installation. A comment that is in the parameter key value for the temporary is the department, if again crossing lost some of the rest of the parameters of the material or Xu about my comments have corrected the addition of farewell advice.
The first parameter of the AVAUDIORECORDER structure dependent variable is a once-out argument to destroy the error message of the audio recording, if there is no message to destroy the fallacy indirectly installed as empty. And then our avaudiorecorder to the elephant as if it seems to have come true, slow, no, what would be a reminder of falsehood? Look carefully, it is the results of the road, don't worry, but avaudiorecorder with you opened a little joke, because he really too lazy, have no intention to convert the string into a URL, because we have to manually convert ~ Yes, the use of nsurl dynamic approach URLWithString can be processed ~ then just call the record method to start the sound. But the code above but the example, the proposal is in the writing order of cent, our avaudiorecorder for the elephant to fame is in the class attribute. Stop the call to Avaudiorecorder when the demand end is not filled.
Avaudiorecorder for like the emergence of the rise will probably be more trouble, but the use of the rise is very easy, just the beginning of the call record, pause time call pause method, and the end of the call stop method can be.
Absolutely in the sound, play the audio can say easy to be able, we are creating avaudioplayer for the elephant at the time as long as the pre-filling of the information to it, and to the once empty fallacy out of the argument can be strained to create a once avaudioplayer for the elephant, The use of the rise of the same kind of bento just call the play dependent variable can ~ ~ ~ He and Avaudiorecorder can also need to pause and stop performance, it can support speed conditioning it? Want to know the words did not like with the active reminder to open his list of ways to see it ~ all seem to be easy, we are important to a happy naught, but when you run the order but surprised to find out what to do play no sound! Use itools class of hardware to review the sequence of docment programs, right Ah! The information is AH ~, did I record the wrong? And that kind of million can emerge in your head like that! Well, I really don't have unsympathetic to look at you, like me. How many hours of dull study, but because you did not put Avaudioplayer in the sample code in the class properties ... Yes, if you say it again in this way and call the play dependent variable you will find out what kind of play is not sound, if you are calling the play method of the status of the installation of the breakpoint and then listen carefully to hear a small sound, what to do? Since you have just called the play method your avaudioplayer for the elephant is acquitted, there is nothing to play no sound ~ Use the avaudioplayer to put it into the class of the attribute bar!
The above content are Hangzhou Jacu chat room developers for mobile phone chat room a simple production sharing.


This article is from "Hangzhou Jacu Technology" blog, please be sure to keep this source http://zxchk.blog.51cto.com/9679895/1589151

The most comprehensive mobile chat room development experience in the history of sharing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.